<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/22 0022
 * Time: 上午 12:03
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class Contact extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');
    }

    public function index()
    {
        $data['title']='新闻中心';
        //渲染页面
        // 查询所有的的新闻信息
        // $data['news']=$this ->db ->limit(6)->get('news')->result_array();
        // print_r($data);die;
        $this->load->view('home/header',$data);   //公共的头部
        $this->load->view('home/contact',$data);  //主体内容
        $this->load->view('home/footer',$data);  //尾部

    }
    public function content()
    {
       $post=$this ->input ->post();
       // print_r($post);
       $post['cont_time']=time();
       $res=$this ->db ->insert('content',$post);
       // echo "$res";
       if ($res) {
           // echo "<script type='text/javascript'>
           //     alert('留言成功')
           // </script>";
           redirect('face/contact/index');
       }
    }







}